home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / bash / bash_108 / src_d2.zoo / bash-d2.zoo / libgcc / fcntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-03  |  2.5 KB  |  113 lines

  1. /*
  2.  *    FCNTL.H
  3.  */
  4.  
  5. #ifndef    _FCNTL_H
  6. #define    _FCNTL_H
  7.  
  8. #if defined(__cplusplus)
  9. extern "C" {
  10. #endif
  11.  
  12. #define    O_RDONLY    0x00        /* read only */
  13. #define    O_WRONLY    0x01        /* write only */
  14. #define    O_RDWR        0x02        /* read/write */
  15. #define    O_NDELAY    0x04        /* Non-blocking I/O */
  16. #ifdef __MINT__
  17. #define O_SYNC        0x08        /* sync after writes */
  18. #endif
  19. #define    O_APPEND    0x10        /* position at EOF */
  20. #define    O_CREAT        0x20        /* create new file if needed */
  21. #define    O_TRUNC        0x40        /* make file 0 length */
  22. #define    O_EXCL        0x80        /* error if file exists */
  23. #define O_PIPE          0x100           /* a serial pipe. */
  24. /*
  25.  * access
  26.  */
  27. #define    F_OK            0
  28. #define    X_OK            1
  29. #define    W_OK            2
  30. #define    R_OK            4
  31.  
  32. #define    F_DUPFD        0    /* Duplicate fildes */
  33. #define    F_GETFD        1    /* Get fildes flags */
  34. #define    F_SETFD        2    /* Set fildes flags */
  35. #define    F_GETFL        3    /* Get file flags */
  36. #define    F_SETFL        4    /* Set file flags */
  37.  
  38. #ifdef __MINT__
  39. #define F_GETLK        5    /* Get file lock */
  40. #define F_SETLK        6    /* Set file lock */
  41.  
  42. struct flock {
  43.     short l_type;
  44. #define F_RDLCK        O_RDONLY
  45. #define F_WRLCK        O_WRONLY
  46. #define F_UNLCK        3
  47.     long l_start;
  48.     long l_len;
  49.     short l_pid;
  50. };
  51. #endif /* __MINT__ */
  52.  
  53. /* defs for handle frob */
  54.  
  55. #define __NHANDLES    40
  56.  
  57. #ifndef __MINT__
  58. struct __open_file {
  59.     unsigned short append:1;    /* 1 if O_APPEND set for this file */
  60.     unsigned short nodelay:1;    /* 1 if O_NDELAY set for this file */
  61.     unsigned short pipe:1;      /* 1 if O_PIPE set for this file */
  62.     unsigned short status:2;    /* status FH_UNKNOWN | ISATTY | ISAFILE */
  63.     unsigned short eclose:1;    /* 1 if close on exec is set for this file */
  64.     char       *filename;    /* filename of open file */
  65. };
  66.  
  67. #ifndef __FHANDLE_C__
  68. extern struct __open_file __open_stat[];
  69. #endif
  70.  
  71. #else /* __MINT__ */
  72.  
  73. struct __open_file {
  74.         short   status;         /* whether or not it's a tty */
  75.         short   flags;          /* if a tty, its flags */
  76. };
  77.  
  78. extern struct __open_file __open_stat[__NHANDLES];
  79. #endif /* __MINT */
  80.  
  81.   /* NOTE: this array is indexed by (__OPEN_INDEX(fd)) */
  82.  
  83. /* smallest valid gemdos handle */
  84. /* note handle is only word (16 bit) negative, not long negative,
  85.    and since Fopen etc are declared as returning long in osbind.h
  86.    the sign-extension will not happen -- thanks ers
  87. */
  88. #ifdef __MSHORT__
  89. #define __SMALLEST_VALID_HANDLE (-3)
  90. #else
  91. #define __SMALLEST_VALID_HANDLE (0)
  92. #endif
  93.  
  94. #define __OPEN_INDEX(x)    (((short)(x)) + 3)
  95.  
  96. #define FH_UNKNOWN    0
  97. #define FH_ISATTY    1
  98. #define FH_ISAFILE    2
  99.  
  100.  
  101. #ifndef _COMPILER_H
  102. #include <compiler.h>
  103. #endif
  104.  
  105. __EXTERN int fcntl __PROTO((int f, int cmd, ...));
  106.  
  107.  
  108. #if defined(__cplusplus)
  109. }
  110. #endif
  111.  
  112. #endif /* _FCNTL_H */
  113.